package com.woniuxy.bookmallmanagersrever.controller;

import com.woniuxy.bookmallmanagersrever.entity.TBooktype;
import com.woniuxy.bookmallmanagersrever.entity.TRole;
import com.woniuxy.bookmallmanagersrever.service.BookTypeService;
import com.woniuxy.bookmallmanagersrever.vo.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class BookTypeController {

    @Autowired
    BookTypeService bookTypeService ;

    @GetMapping("/bookType/getAllType")
    public ResponseResult<List<TBooktype>> getAllType(){
        ResponseResult<List<TBooktype>> result = new ResponseResult<>();
        try {
            List<TBooktype> lists = bookTypeService.findAllTypes();
            result.setCode(200);
            result.setMsg("查询成功!");
            result.setData(lists);
        }catch (Exception e) {
            e.printStackTrace();
            result.setCode(201);
            result.setMsg("查询失败!");
        }
        return result ;
    }


}
